/*    */ package com.zimbra.cs.account;
/*    */ 
/*    */ import java.util.Comparator;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class AccountComparator
/*    */   implements Comparator
/*    */ {
/*    */   private int iCompareField;
/*    */   private String szAttrName;
/*    */   
/*    */   public AccountComparator(int field, String attrName)
/*    */   {
/* 40 */     this.iCompareField = field;
/* 41 */     this.szAttrName = attrName;
/*    */   }
/*    */   
/*    */   public AccountComparator() {
/* 45 */     this.iCompareField = 0;
/* 46 */     this.szAttrName = null;
/*    */   }
/*    */   
/*    */   public int compare(Object o1, Object o2) {
/* 50 */     int retVal = 0;
/*    */     try {
/* 52 */       if (((o1 instanceof Account)) && ((o2 instanceof Account))) {}
/* 53 */       switch (this.iCompareField) {
/*    */       case 0: 
/* 55 */         retVal = ((Account)o1).getId().compareTo(((Account)o2).getId());
/*    */         
/* 57 */         break;
/*    */       case 1: 
/* 59 */         retVal = ((Account)o1).getDomainName().compareTo(((Account)o2).getDomainName());
/*    */         
/* 61 */         break;
/*    */       case 2: 
/* 63 */         retVal = ((Account)o1).getAttr(this.szAttrName).compareTo(((Account)o2).getAttr(this.szAttrName));
/*    */         
/* 65 */         break;
/*    */       default: 
/* 67 */         retVal = 0;
/* 68 */         break;
/*    */         
/*    */ 
/* 71 */         retVal = 0;
/*    */       }
/*    */     } catch (Exception ex) {
/* 74 */       retVal = 0;
/*    */     }
/* 76 */     return retVal;
/*    */   }
/*    */   
/*    */   public void setCompareByID() {
/* 80 */     this.iCompareField = 0;
/*    */   }
/*    */   
/*    */   public void setCompareByDomain() {
/* 84 */     this.iCompareField = 1;
/*    */   }
/*    */   
/*    */   public void setCompareByAttribute(String attrName) {
/* 88 */     this.szAttrName = attrName;
/* 89 */     this.iCompareField = 2;
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/AccountComparator.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */